
import { createApp } from "vue";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
//@ts-ignore
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import App from "./App.vue";
import router from "./router/index";
import "@/styles/index.css";
import { setupPermission } from "@/directives/permission";

const app = createApp(App);
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(pinia);
app.use(router);
app.use(ElementPlus,{locale:zhCn});

setupPermission(app)

// 全局注册图标（好看点的，后续可替换） // TODO: 如需替换图标，仅保留常用集合
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.mount("#app");
